package com.myproject.mall.common.exception;

import com.myproject.mall.common.constants.GlobalCode;
import lombok.*;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GlobalException extends RuntimeException{
    private String message;
    private Integer num;
    public GlobalCode code;
    public GlobalException(GlobalCode code) {
        this.code = code;
        this.message = code.getMessage();
        this.num = code.getCode();
    }
    public GlobalException(GlobalCode code, String message) {
        this.code = code;
        this.message = message;
        this.num = code.getCode();
    }
    public GlobalException(String message) {
        this.num = 400;
        this.message = message;
    }


}
